< previous page page_433 next page >

Page 433
This method calls three other Private methods. Create the Private Sub OpenDB and add the code from Listing 11.17.
Type.gifListing 11.17. Coding the OpenDB method.
Private Sub OpenDB()
    '
    ' open database/recordset
    '
    On Error GoTo LocalErr
    '
    Set ws = dbengine.Workspaces(0)
    Set db = ws.OpenDatabase(strDBName)
    Set rs = db.OpenRecordset(strSQLSelect, dbOpenSnapshot)
    '
    Exit Sub
    '
LocalErr:
    Err.Raise vbObjectError + 1, App.EXEName, "Error creating data set"
    '
End Sub
Next, add the Private Sub InitGraph and enter the code from Listing 11.18. This code loads the frmGraph form and sets the initial values of the display.
Type.gifListing 11.18. Coding the InitGraph method.
Private Sub InitGraph()
    '
    ' initialize the graph form
    '
    On Error GoTo LocalErr
    '
    rs.MoveLast
    lngNumPoints = rs.RecordCount
    '
    Load frmGraph
    frmGraph.Graph1.GraphType = intGraphType
    frmGraph.Graph1.GraphTitle = strTitle
    frmGraph.Graph1.NumSets = 1
    frmGraph.Graph1.NumPoints = lngNumPoints
    frmGraph.Graph1.AutoInc = 1
    '
    Exit Sub
    '
LocalErr:
    Err.Raise vbObjectError + 2, App.EXEName, "Error intializing graph form"
    '
End Sub

 
< previous page page_433 next page >

If you like this book, buy it!